package com.shujia.compute

import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment
import org.apache.flink.api.scala._
object TestWC {
  def main(args: Array[String]): Unit = {




    val env = StreamExecutionEnvironment.getExecutionEnvironment
    val ds = env.fromCollection(List("java,spark", "java,spark"))

    ds.flatMap(_.split(","))
      .map(w => (w, 1))
      .keyBy(_._1)
      .reduce((x, y) => (x._1, x._2 + y._2))
      .print()

    env.execute("TestWC")


  }
}
